package thinkingJava.chapter09;

class FilterAdapter implements IProcesser {
	Filter filter;
	FilterAdapter(Filter filter) {
		this.filter = filter;
	}
	public String name() {
		return filter.name();
	}

	public WaveForm process(Object input) {
		return filter.process((WaveForm)input);
	}

}
public class FilterProcesser {
	public static void main(String[] args) {
		WaveForm w = new WaveForm();
		Apply2.process(new FilterAdapter(new LowPass(1.0)), w);
		Apply2.process(new FilterAdapter(new HighPass(2.0)), w);
		Apply2.process(new FilterAdapter(new BandPass(2.0, 3.0)), w);
	}
}
class Apply2 {
	public static void process(IProcesser p,Object o) {
		System.out.println(p.name());
		System.out.println(p.process(o));
	}
}
